package cn.yikaojiuguo.student.ui.ask;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import cn.yikaojiuguo.student.adapter.ImgsAdapter;
import cn.yikaojiuguo.student.support.simple.ArgsConstants;
import cn.yikaojiuguo.student.support.utils.LogUtil;
import cn.yikaojiuguo.student.ui.base.BaseImgsActivity;

public class AskImgsActivity extends BaseImgsActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void deletePic() {
        LogUtil.showInfoLog("mPos","mPos = " + mPos);
        mList.remove(mPos);
        if(mList.size() == 0) {
            Intent data = new Intent();
            data.putStringArrayListExtra(ArgsConstants.PICS,mList);
            setResult(Activity.RESULT_OK,data);
            finish();
        } else if(mList.size()>mPos) {
            mAdapter = new ImgsAdapter(this,mList);
            mVp.setAdapter(mAdapter);
            mVp.setCurrentItem(mPos);
        } else {
            mAdapter = new ImgsAdapter(this,mList);
            mVp.setAdapter(mAdapter);
            mVp.setCurrentItem(mList.size() - 1);
            mPos = mList.size() - 1;
        }
    }
}
